<?php
	require_once("Model/Boat.php");
	
	class BoatCatalogModel
	{
		//sql
		private $sqlGetBoats = "SELECT *
								FROM boat";
								

		
		private $db = NULL;
        
        public function __construct(Database $db) 
        {
                $this->db =$db;
        }
		
		public function AddBoat($member_id, $type, $lenght)
		{

		}
		
		public function DeleteBoat($id)
		{

		}
		
		public function EditBoat($member_id, $type, $lenght)
		{
		
		}
		
		public function GetBoats()
		{
			$sqlQuery = $this->sqlGetBoats;
			$stmt = $this->db->PrepareSql($sqlQuery);
			$stmt = $this->db->ExecuteAndReturnQuery($stmt);
			$stmt->bind_result($boatId, $memberId, $type, $lenght);
			
			$boats = new BoatArray();
			
			while($stmt->fetch())
			{
				$boat = new Boat($boatId, $memberId, $type, $lenght);
				$boats->Add($boat);
			}
			
			$stmt->Close();

			return $boats;
			
		}
		
	}